﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>菜单设置表</title>
    <!--<link href="../../script/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../script/css/bootstrap-table.css" rel="stylesheet" />
    <script src="../../script/js/jquery-1.12.3.js"></script>
    <script src="../../script/js/bootstrap.min.js"></script>
    <script src="../../script/js/bootstrap-table.js"></script>
    <script src="../../script/js/bootstrap-table-zh-CN.js"></script>
    <script src="../../script/js/cus-grid.js"></script>
    <script src="../../script/js/cus-dirs.js"></script>-->
</head>
<body>
    <div style="width:100%">
        <table name="sys_menu"></table>
    </div>
    <script name="loadPage">
        var sys_menu_init;

        var sys_menu = {
        data: {
                data:[]
        },
        detailLink:[],
            rowbtns:[],
        toolbtns:[],
        cols:[],
        new: function () {
            sys_menu_init.editLoad('sys_menu_edit.html');
        },
        edit: function () {
            sys_menu_init.editLoad('sys_menu_edit.html');
        },
        del: function () {
            $.post('/api/sys_menu/del', { id: sys_menu_init.getId_edit }, function () {
                window.location.reload();
        });
        },
        mdel: function () {
            $.post('/api/sys_menu/mdel', { objs: sys_menu_init.getSelects() }, function () {
                window.location.reload();
        });
        },
        check: function () {

        },
        mcheck: function () {

        }
        };

        $(function () {
            sys_menu.cols = [
{field: 'code',title: '编号'}
,{field: 'name',title: '菜单名'}
,{field: 'icon',title: '图标'}
,{field: 'url',title: '地址'}
,{field: 'pid',title: '上级菜单',formatter: function (val, row, idx) {
                                            var str = '';
                                            for (var i = 0; i < sys_menu.data['pid'].length; i++) {
                                                var p = sys_menu.data['pid'][i];
                                                if (p.id == val) {
                                                    str = str == '' ? p.text : str + ',' + p.text;
                                                }
                                            }
                                            return str;
                                        }}
                ];

            sys_menu.rowbtns.push({
                text: '编辑',
                fn: 'sys_menu.edit'
            });
            sys_menu.rowbtns.push({
                text: '删除',
                fn: 'sys_menu.del'
            });
            sys_menu.rowbtns.push({
                jstr: '<button class="btn btn-danger" onclick="sys_menu.check();">审核</button>'
            });

            sys_menu.toolbtns.push({
                text: '新增',
                fn: 'sys_menu.new'
            });
            sys_menu.toolbtns.push({
                text: '删除',
                fn: 'sys_menu.mdel'
            });
            sys_menu.toolbtns.push({
                jstr: '<button class="btn btn-danger" onclick="sys_menu.mcheck();">审核</button>'
            });

            sys_menu.detailLink.push({
                tablename: 'sys_menuRole',
                parentid: 'id',
                caption: '角色配置',
                isActive: true
            });

            sys_menu_init = sys_menu_init == undefined ? cusGrid() : function () {
                return sys_menu_init.reCreate();
            }();
            $.get('/api/sys_menu/get',
null ,
                    function (data) {
            sys_menu.data = data;
        sys_menu_init.init({
            data: sys_menu.data,
                detailLink: sys_menu.detailLink,
                    rowbtns: sys_menu.rowbtns,
                        toolbtns: sys_menu.toolbtns,
                            cols: sys_menu.cols,
                                isSelect:true,
                                tableName: 'sys_menu'
                            });
        sys_menu_init.initCard_mobile();
        });
        })
    </script>



</body>
</html>
